package com.fdd.op.sdk.constants;

import java.text.SimpleDateFormat;

/**
 * 公用常量类
 *
 * @author Fadada
 * @date 2021/04/26
 */
public abstract class Constants {
    /**
     * 鉴权方式
     */
    public static final String AUTH_SIGN = "sign";
    public static final String AUTH_OAUTH = "oauth";

    /**
     * Fdd sign协议入参共享参数
     **/
    public static final String APP_ID = "appId";
    public static final String APP_KEY = "appKey";
    public static final String METHOD = "method";
    public static final String TIMESTAMP = "timestamp";
    public static final String VERSION = "version";
    public static final String SIGN = "sign";
    public static final String SIGN_METHOD = "signType";
    public static final String SESSION = "session";
    public static final String SIMPLIFY = "simplify";
    public static final String TARGET_APP_KEY = "target_app_key";
    /**
     * Fdd oauth协议入参共享参数
     **/
    public static final String OAUTH_AUTHORIZATION = "Authorization";
    public static final String OAUTH_BEARER = "bearer ";
    /**
     * Fdd协议出参共享参数
     */
    public static final String ERROR_RESPONSE = "error_response";
    public static final String ERROR_CODE = "code";
    public static final String ERROR_MSG = "message";

    /**
     * 默认时间格式
     **/
    public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
    public static final SimpleDateFormat DATEFORMAT = new SimpleDateFormat("yyyyMMddHHmmss");

    /**
     * Date默认时区
     **/
    public static final String DATE_TIMEZONE = "GMT+8";

    /**
     * UTF-8字符集
     **/
    public static final String CHARSET_UTF8 = "UTF-8";

    /**
     * HTTP请求相关
     **/
    public static final String METHOD_POST = "POST";
    public static final String METHOD_GET = "GET";
    public static final String CTYPE_FORM_DATA = "application/x-www-form-urlencoded";
    public static final String CTYPE_FILE_UPLOAD = "multipart/form-data";
    public static final String CTYPE_TEXT_XML = "text/xml";
    public static final String CTYPE_TEXT_JAVASCRIPT = "text/javascript";
    public static final String CTYPE_TEXT_PLAIN = "text/plain";
    public static final String CTYPE_TEXT_DATA = "form-data";
    public static final String CTYPE_TEXT_ALL = "*/*";
    public static final String CTYPE_APP_JSON = "application/json";

    /**
     * GBK字符集
     **/
    public static final String CHARSET_GBK = "GBK";

    /**
     * JSON 应格式
     */
    public static final String FORMAT_JSON = "json";
    /**
     * XML 应格式
     */
    public static final String FORMAT_XML = "xml";

    /**
     * MD5签名方式
     */
    public static final String SIGN_METHOD_MD5 = "MD5";
    public static final String MAC_HMAC_MD5 = "HmacMD5";
    /**
     * SHA256签名方式
     */
    public static final String SIGN_METHOD_SHA256 = "SHA256";

    /**
     * SDK版本号
     */
    public static final String SDK_VERSION = "sdk-java-20180601";

    /**
     * 异步多活SDK版本号
     */
    public static final String SDK_VERSION_CLUSTER = "sdk-java-cluster-20180601";

    /**
     * httpdns SDK版本号
     */
    public static final String SDK_VERSION_HTTPDNS = "sdk-java-httpdns-20180601";

    /**
     * httpdns SDK版本号
     */
    public static final String QIMEN_SDK_VERSION_HTTPDNS = "qimen-sdk-java-httpdns";

    /**
     * 响应编码
     */
    public static final String ACCEPT_ENCODING = "Accept-Encoding";
    public static final String CONTENT_ENCODING = "Content-Encoding";
    public static final String CONTENT_ENCODING_GZIP = "gzip";

    /**
     * 默认媒体类型
     **/
    public static final String MIME_TYPE_DEFAULT = "application/octet-stream";

    /**
     * 默认流式读取缓冲区大小
     **/
    public static final int READ_BUFFER_SIZE = 1024 * 4;

    public static final String HTTP_DNS_HOST = "HTTP_DNS_HOST";

    /**
     * 字符串常量标识
     **/
    public static final String STRING_0_FLAG = "0";
    /**
     * 缓存有效期
     **/
    public final static Long MAX_5_EXPIRE = 5 * 60L;
    /**
     * 默认的缓存容量
     */
    public static final int DEFAULT_CAPACITY = 512;
    /**
     * 最大容量
     */
    public static final int MAX_CAPACITY = 100000;
    /**
     * 刷新缓存的频率
     */
    public static final int MONITOR_DURATION = 2;
}
